package com.platform.service.impl;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.platform.annotation.Authentication;
import com.platform.base.BaseServiceImpl;
import com.platform.base.mvc.IBaseMapper;
import com.platform.context.SSOUserContext;
import com.platform.dao.SysLogErrorDAO;
import com.platform.dto.SysLogErrorDTO;
import com.platform.logger.model.ErrorLogModel;
import com.platform.logger.service.IErrorLogService;
import com.platform.service.SysLogErrorService;

/**
 * 错误日志; InnoDB free: 368640 kB
 * 
 * @author platform
 * @email 15909910367@163.com
 * @date 2022-10-28 17:37:15
 */
@Service("sysLogErrorService")
public class SysLogErrorServiceImpl extends BaseServiceImpl<SysLogErrorDTO> implements SysLogErrorService,IErrorLogService {
	@Autowired
	private SysLogErrorDAO sysLogErrorDAO;

	@Override
	public IBaseMapper<SysLogErrorDTO> getMapper() {
		return sysLogErrorDAO;
	}

	@Override
	@Authentication
	public void saveErrorLog(ErrorLogModel errorLog) {
		SysLogErrorDTO dto = new SysLogErrorDTO();
		BeanUtils.copyProperties(errorLog, dto);
		dto.setCreateUser(SSOUserContext.getContext().getLoginName());
		sysLogErrorDAO.insert(dto);
	}
}
